package lynch.map 
{
	import lynch.Core.config.ration.Core.config.
	import starling.display.Image;
	import starling.textures.Texture;
	import lynch.net.loading.LynchLoader;
	
	/**
	 * only open for WorldMap
	 * @author 小痛
	 */
	internal class Tile extends Image 
	{
		public var id:int;
		private var lyloader:LynchLoader;
		
		public function Tile(texture:Texture) 
		{
			super(texture);
		}
		
		public function updateInfo(id:int, mapID:int):void
		{
			this.id = id;
			lyloader = new LynchLoader("resource/image/mapTiles/" + mapID + "/" + id + ".jpg", onTileLoaded, true, "binary");
			lyloader.load(null);
		}
		
		private function onTileLoaded(l:LynchLoader):void 
		{
			texture = Texture.fromBitmapData(l.data.bitmapData);
			lyloader = null;
		}
	}
}